<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Title</title>
    <style>
        body{
            background-color: white;
            transition: background-color 0.5s;
        }
        h1{
            color: black;
            transition: color 0.5s;
        }
        h1 span{
            display: block;
            color: mediumvioletred;
            padding: 10px 50px;
            font-size: 20px;
        }
        #temp_video,#temp_video:focus{
            width: 100%;
            outline: none;
            max-height: 550px;
        }
    </style>
</head>
<body>
    <h1>网站正在开发中....
        <span id="video_title">正在播放：null</span>
    </h1>
    <video src="https://n30-pl-agv.autohome.com.cn/video-42/E3BD4E39114FD258/2020-06-12/C590ED8E84B86C346F15C4841F4F2CE2-300-wm.mp4?key=9395085E374FAE66702BD34C2489F713&time=1617891153" id="temp_video" class="temp_video" autoplay controls></video>
    <script>
        setTimeout(function () {
            document.getElementsByTagName('body')[0].style.backgroundColor='black'
            document.getElementsByTagName('h1')[0].style.color='white'
        },500)
        let video=document.getElementById('temp_video')
        let title=document.getElementById('video_title')
        video.play()
        let videoSrcIndex=0
        fetch('/ordinary/files',{method:'GET'})
            .then(res => {
            res.json().then(data => {
                console.log(data)
                video.src=data[videoSrcIndex].url
                title.textContent='正在播放：'+data[videoSrcIndex].name
                videoSrcIndex++
                video.play()
                video.addEventListener('ended',function () {
                    if (videoSrcIndex==data.length){
                        videoSrcIndex=0
                    }
                    video.src=data[videoSrcIndex].url
                    title.textContent='正在播放：'+data[videoSrcIndex].name
                    video.play()
                    videoSrcIndex++
                })
            })
        }).catch(err => {
            console.log('错误'+err)
        })


    </script>
</body>
</html>